]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
history: Stop saving non-consecutive duplicate entries
authorPascal Nowack <Pascal.Nowack@gmx.de>
Sat, 22 Sep 2018 15:43:22 +0000 (17:43 +0200)
committerPascal Nowack <Pascal.Nowack@gmx.de>
Wed, 26 Sep 2018 06:38:47 +0000 (08:38 +0200)
Whenever a command runs in the run dialog, it
will be added to the history unless it is
already the last entry. This does not apply
for entries that are not consecutive, which can
result in long chains of commands which
alternate, e.g. lg, r, lg, r, lg, r. Not only is
this wasteful in terms of space, but also
inconsistent with how history works elsewhere,
e.g. in the shell.

Therefore, remove entries in the history that are
equal to the one that will be added to the end of
of the history when the entry already exists.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/524

js/misc/history.js

index 693e6de1cf9b6add412384a323202323b58be61c..f1d037018b16ff039183a97bd0793bb2bc50b617 100644 (file)
@@ -76,6 +76,7 @@ var HistoryManager = new Lang.Class({
         if (this._history.length == 0 ||
             this._history[this._history.length - 1] != input) {
 
+            this._history = this._history.filter(entry => entry != input);
             this._history.push(input);
             this._save();
         }